<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AlterAfterSale extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('after_sale', function (Blueprint $table) {
            $table->increments('id');
            $table->string('refund_sn')->comment('退款编号');
            $table->unsignedInteger('user_id')->comment('用户id');
            $table->unsignedInteger('order_item_id')->comment('订单id');
            $table->unsignedInteger('order_id')->comment('订单id');
            $table->tinyInteger('type')->comment('1 退货退款 2 保修');
            $table->tinyInteger('status')->comment('1 待审核 2 售后成功 3 售后关闭')->default(1);
            $table->string('reason')->comment('退款原因');
            $table->string('image', 500)->comment('凭证');
            $table->decimal('refund_price', 10,2)->comment('退款金额')->default(0);
            $table->string('reject_reason')->comment('驳回原因')->nullable();
            $table->string('refund_logistics_sn')->comment('退款物流单号单号')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('after_sale');
    }
}
